/*
 * Criado em Mar 21, 2005
 *
 *
 */
package vendas.dto;

import gminet.infra.dao.SimpleTransferObject;

import java.util.List;

/**
 * @author Gabriel Flores Mendes
 * 
 * 
 */
public class SellStatus extends SimpleTransferObject {

    private static final long serialVersionUID = 7816703310395988298L;
    
    private static final byte UNDEFINED_ID = 0;
    private static final byte RECEIVE_PAYMENT_ID = 10;
    private static final byte UNRECEIVE_PAYMENT_ID = 20;

    public static final SellStatus UNDEFINED = new SellStatus(UNDEFINED_ID, "INDEFINIDO");
    public static final SellStatus RECEIVE_PAYMENT = new SellStatus(RECEIVE_PAYMENT_ID, "Pagamento recebido");
    public static final SellStatus UNRECEIVE_PAYMENT = new SellStatus(UNRECEIVE_PAYMENT_ID, "Pagamento a receber");

    static {
        Class<SellStatus> clazz = SellStatus.class;
        addObject(clazz, RECEIVE_PAYMENT);
        addObject(clazz, UNRECEIVE_PAYMENT);
    }

    private SellStatus(int i, String str) {

        super(i, str);
    }
    
    public boolean isReceivePayment() {

        return getId() == RECEIVE_PAYMENT_ID;
    }

    public boolean isUnreceivePayment() {

        return getId() == UNRECEIVE_PAYMENT_ID;
    }
    
    public void setReceivePayment(boolean receivePayment) {
        setId(receivePayment ? RECEIVE_PAYMENT_ID : UNRECEIVE_PAYMENT_ID);
    }


    @SuppressWarnings("unchecked")
    public static List<SellStatus> getList() {

        return (List<SellStatus>) getList(SellStatus.class);
    }

    public static SellStatus getSellStatusById(int statusId) {

        return (SellStatus) getObject(SellStatus.class, statusId);
    }

}
